//
//  MenuViewController.m
//  LO_MUSIC
//
//  Created by 向祖华 on 16/2/24.
//  Copyright © 2016年 杨少锋. All rights reserved.
//

#import "MenuViewController.h"
#import "AppDelegate.h"
#import "MusicViewController.h"
#import "ReadViewController.h"

@interface MenuViewController ()




@end

@implementation MenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton * music = [UIButton buttonWithType:(UIButtonTypeSystem)];
    music.frame = CGRectMake(50, 200, 100, 50);
    [music setTitle:@"音乐" forState:(UIControlStateNormal)];
    [music addTarget:self action:@selector(musicAction) forControlEvents:(UIControlEventTouchUpInside)];
    
    [self.view addSubview:music];
    
    UIButton * read = [UIButton buttonWithType:(UIButtonTypeSystem)];
    read.frame = CGRectMake(50, 300, 100, 50);
    [read setTitle:@"阅读" forState:(UIControlStateNormal)];
    [read addTarget:self action:@selector(readAction) forControlEvents:(UIControlEventTouchUpInside)];
    
    [self.view addSubview:read];
}

-(void)musicAction
{
    //
    MusicViewController * music = [MusicViewController new];
    UINavigationController * music_na = [[UINavigationController alloc]initWithRootViewController:music];
    //设置根视图控制器
    AppDelegate * app = [UIApplication sharedApplication].delegate;
    
    [app.draw setRootViewController:music_na];
}

-(void)readAction
{
    ReadViewController * read = [ReadViewController new];
    
    //设置根视图控制器
    AppDelegate * app = [UIApplication sharedApplication].delegate;
    
    UINavigationController * read_na = [[UINavigationController alloc]initWithRootViewController:read];
    [app.draw setRootViewController:read_na];
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
